package com.wzdigit.wms.basic.enums.log;


import com.wzdigit.wms.basic.enums.BaseEnum;

import java.util.*;

/**
 * SN从操作日志枚举
 */
public enum GoodsLogEnum implements BaseEnum {
    /**
     * 下线同步条码到WMS_GOODS表,同步条码到WMS_GOODS表(库存初始化),同步条码到WMS_GOODS表(外基地导入)
     */
    CREATE("CREATE","物料数据建档","SN操作日志枚举"),
    /**
     * 库存初始化
     */
    INVENTORYINIT("INVENTORYINIT","库存初始化","SN操作日志枚举"),
    /**
     * 下线交收
     */
    DOWN_LINE_SETTLEMENT("RECEIVE","下线交收","SN操作日志枚举"),
    /**
     * 转仓
     */
    TRANSFER_OUT("TRANSFER_OUT","转仓出库(转出)","SN操作日志枚举"),
    /**
     * 转仓接收
     */
    TRANSFER_IN("TRANSFER_IN","转仓接收(转入)","SN操作日志枚举"),
    /**
     * 上架
     */
    PUT_ON("PUT_ON","上架","SN操作日志枚举"),
    /**
     * 下架
     */
    PUT_OFF("PUT_OFF","下架","SN操作日志枚举"),
    /**
     * 翻牌
     */
    QA_STATUS_CHANGE("QA_STATUS_CHG","品质状态变更","SN操作日志枚举"),
    /**
     * 其它入库
     */
    OTHER_STOCK_IN("RECEIVE","其他入库","SN操作日志枚举"),
    /**
     * 拣货
     */
    PICK("PICK","拣货","SN操作日志枚举"),
    /**
     * 取消拣货
     */
    UN_PICK("UN_PICK","取消拣货","SN操作日志枚举"),
    /**
     * 发货装运
     */
    SHIP("SHIP","发货装运","SN操作日志枚举"),
    /**
     * 取消装运
     */
    UN_SHIPPING("UN_SHIP","取消装运","SN操作日志枚举"),
    /**
     * 调拨
     */
    TRANSFER("TRANSFER","调拨","SN操作日志枚举"),
    /**
     *
     */
    OTHER_STOCK_OUT("SHIP","其他出库","SN操作日志枚举"),
    /**
    *
    */
    REMAIN("REMAIN","余留","SN操作日志枚举"),
    /**
     * 出库拣料
     */
    RAW_PICK("PICK","拣货","SN操作日志枚举"),
    /**
     * 出库拣料
     */
    RAW_UN_PICK("UN_PICK","取消拣料","SN操作日志枚举"),
    /**
     * 拆分
     */
    RAW_SPLIT("SPLIT","物料数量超拣料需求导致的拆包","SN操作日志枚举");
    

    @Override
    public String toString() {
        return "GoodsLogEnum{" +
                "code='" + code + '\'' +
                ", enumName='" + enumName + '\'' +
                ", description='" + description + '\'' +
                '}';
    }

    /**
     * 枚举值
     */
    public String code;

    /**
     * 枚举名称
     */
    public String enumName;

    /**
     * 枚举实体类属性描述
     */
    public String description;

    GoodsLogEnum(String enumName, String description) {
        this.enumName = enumName;
        this.description = description;
    }

    GoodsLogEnum(String code, String enumName, String description) {
        this.code = code;
        this.enumName = enumName;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }
    
    public String getEnumName() {
        return enumName;
    }

    public void setEnumName(String enumName) {
        this.enumName = enumName;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public static GoodsLogEnum getEnumByCode(String enumCode) {
        GoodsLogEnum[] values = GoodsLogEnum.values();
        GoodsLogEnum samplingEnum = null;

        for (GoodsLogEnum value : values) {
            if (value.getCode().equals(enumCode)) {
                samplingEnum = value;
                break;
            }
        }
        return samplingEnum;
    }

    public static GoodsLogEnum getEnumByName(String enumName) {
        GoodsLogEnum[] values = GoodsLogEnum.values();
        GoodsLogEnum repairEnum = null;

        for (GoodsLogEnum value : values) {
            if (value.getEnumName() == enumName) {
                repairEnum = value;
            }
        }
        return repairEnum;
    }

    public static String getCodeByEnumNameAndDescription(String enumName, String enumDescription) {
        GoodsLogEnum[] values = GoodsLogEnum.values();
        for (GoodsLogEnum value : values) {
            if (Objects.equals(value.getDescription(), enumDescription)
                    && Objects.equals(value.getEnumName(), enumName)) {
                return value.getCode();
            }
        }
        return null;
    }

    public static Map<String, String> getEnumByDescription() {
        Map<String, String> enumMap = new HashMap<String, String>();
        GoodsLogEnum[] values = GoodsLogEnum.values();
        for (GoodsLogEnum value : values) {
        	enumMap.put(value.getCode(), value.getEnumName());
        }
        return enumMap;
    }
    
    public static Map<String, String> getEnumByDescription(String enumDescription) {
        Map<String, String> enumMap = new HashMap<String, String>();
        GoodsLogEnum[] values = GoodsLogEnum.values();
        for (GoodsLogEnum value : values) {
            if (Objects.equals(value.getDescription(), enumDescription)) {
                enumMap.put(value.getCode(), value.getEnumName());
            }
        }
        return enumMap;
    }

    public static List<Map<String, Object>> getEnumListByDescription(String enumDescription) {
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
        GoodsLogEnum[] values = GoodsLogEnum.values();
        for (GoodsLogEnum value : values) {
            if (Objects.equals(value.getDescription(), enumDescription)) {
                Map<String, Object> enumMap = new HashMap<String, Object>(2);
                enumMap.put("code", value.getCode());
                enumMap.put("name", value.getEnumName());
                list.add(enumMap);
            }
        }
        return list;
    }
}
